package main

import (
	"dou/initalize/rabbit"
	"dou/internal/dao"
	"dou/internal/model"
	"dou/internal/queue"
	"log"
)

type Test1 struct {
	Test2 string `json:"test2"`
	Test3 string `json:"test3"`
	Test4 string `json:"test4"`
}

func main() {
	rabbit.InitRabbitMq()

	msgs := queue.QueueSub("gongao")

	forever := make(chan bool)
	//启用协程处理消息
	go func() {
		for d := range msgs {
			//消息逻辑处理，可以自行设计逻辑
			log.Printf("Received a message: %s", d.Body)
			var data model.UserContext
			dao.Create(&data)
		}
	}()

	log.Printf(" [*] Waiting for messages. To exit press CTRL+C")
	<-forever
}
